<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>加逗号</title>
</head>
<body>
<script>
    var str="56569845";
    var re=/\d{1,3}/g;
    var arr=str.match(re).join(",");
    console.log(arr);
</script>
</body>
</html>